# 多继承搜索顺序 经典类 新式类
# 经典类：深度优先搜索（从左至右）
# class P1:
#     def foo(self):
#         print('P1---->foo')
#     def bar(self):
#         print('P1---->bar')
#
# class P2:
#     def foo(self):
#         print('P2---->foo')
#
# class C1(P1,P2):
#     pass
#
# class C2(P1,P2):
#     def bar(self):
#         print('C2---->bar')
#
# class D(C1,C2):
#     pass
#
# d = D()
# print(D.__mro__)
# d.foo() # P1---->foo
# d.bar() # C2---->bar
print('------------------------')

# 新式类：广度优先搜索
class P1(object):
    def foo(self):
        print('P1---->foo')
    def bar(self):
        print('P1---->bar')

class P2(object):
    def foo(self):
        print('P2---->foo')

class C1(P1,P2):
    pass

class C2(P1,P2):
    def bar(self):
        print('C2---->bar')

class D(C1,C2):
    pass

print(D.__mro__)
# python3 经典类和新式类无区别
# python2 经典类和新式类有区别




